function getInvoiceType(file) {
    const imageType = file?.imageType || file?.type;
    let suffix;
    if (file?.filename?.includes('.')) {
        suffix = file.filename?.slice(file.filename.lastIndexOf('.') + 1).toLowerCase();
    } else if (file?.resourceKey?.includes('.')) {
        suffix = file.resourceKey?.slice(file.resourceKey.lastIndexOf(".") + 1).toLowerCase();
    } else {
        suffix = imageType?.slice(imageType.lastIndexOf('/') + 1).toLowerCase();
    }
    let type = 'empty';
    if (['ofd', 'pdf', 'xml'].includes(suffix)) {
        type = suffix;
    } else if (imageType?.includes('image') || ['jpg', 'png', 'jpeg', 'bmp', 'gif'].includes(suffix)) {
        type = 'img';
    }
    return type;
}
export default getInvoiceType;